package com.xjh.service.studyjava.testproxy.dynamicproxy;


import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

//卖酒的柜台(实现了InvocationHandler类)
public class GuitaiA implements InvocationHandler {
    //创建一个引用

    private Object pingpai;
    //通过构造方法,给引用赋一个对象

    public GuitaiA(Object pingpai) {
        this.pingpai = pingpai;
    }

//重写invoke方法

    @Override
    public Object invoke(Object proxy, Method method, Object[] args)
            throws Throwable {
        // TODO Auto-generated method stub
        System.out.println("销售开始  柜台是： "+this.getClass().getSimpleName());
        method.invoke(pingpai, args);
        System.out.println("销售结束");
        return null;
    }

}
